extends layout

block scripts
	script(type='text/javascript', src='/socket.io/socket.io.js')
	script(type='text/javascript').
		var socket = io.connect('http://localhost:9241');
		socket.on('chat', function(data) {
			document.getElementById('chat').innerHTML = '<p><b>' + data.title + '</b>: ' + data.content + '</p>';
		});
		var submitChat = function(form) {
			socket.emit('chat', {text: form.chat.value});
		};

block content
	div#chat

	form(onsubmit='return submitChat(this);')
		input#chat(name='chat', type='text')
		input(type='submit', value='Send Chat')